import React from 'react';
import DataTable from 'components/DataTable';
import Icon from 'components/Icon';
import Button from 'components/Button';
import Upload from 'components/Upload';
import checkbox from "../../../../components/Form/model/checkbox";
import { Modal } from "antd";

export default (self) => [
    {
        title: '姓名',
        name: 'name',
        tableItem: {},
        searchItem: {
            group: 'abc'
        },
        formItem: {
            rules: [
                {
                    required: true,
                    message: '请输入姓名'
                }
            ]
        },
    },
    {
        title: '年龄',
        name: 'age',
        tableItem: {},
        formItem: {
            rules: [
                {
                    required: true,
                    message: '请输入年龄'
                }
            ],
            type: 'number',
            min: 18,
            max: 99
        },
    },
    {
        title: '案例数',
        name: 'case_count',
        tableItem: {},
        formItem: {
            type: 'number',
            rules: [
                {
                    required: true,
                    message: '请输入案例数'
                }
            ]
        },
    },
    {
        title: '身份证',
        name: 'id_number',
        tableItem: {},
        formItem: {},
    },
    {
        title: '手机号',
        name: 'mobile',
        tableItem: {},
        formItem: {
            rules: [
                {
                    required: true,
                    message: '请输入案例数'
                }
            ]
        },
    },
    {
        title: '技能',
        name: 'skills',
        tableItem: {},
        formItem: {
            rules: [
                {
                    required: true,
                    message: '请输入技能,多个技能用|分开'
                }
            ]
        },
    },
    {
        title: '工龄',
        name: 'work_age',
        tableItem: {},
        formItem: {
            type: 'number',
            rules: [
                {
                    required: true,
                    message: '请输入工龄'
                }
            ]
        },
    },
    {
        title: '直接上传',
        name: 'face_arr',
        formItem: {
            type: 'upload',
            listType: 'picture',
            action: '/system/upload/?savePath=article', // 后台接口 例：/uploadFile 会走代理
            fileName: 'file', // 后台接收的名字
            rules: [
                {
                    required: true,
                    message: '请选择图片'
                }
            ],
            maxFileSize: 1000, // 最大限制 kb
            max: 1
        }
    },
    {
        title: '状态',
        name: 'status_check',
        dict: [{ code: 1 }],
        formItem: {
            type: 'checkbox',
            initialValue: [1]
        }
    },
    {
        title: '状态',
        name: 'status',
        tableItem: {
            render: (value, record) => {
                return <DataTable.Oper>
                    <Icon type={value ? 'check' : 'close'} style={value ? { color: 'green' } : { color: 'red' }} ></Icon>
                </DataTable.Oper>
            }
        },
    },
    {
        title: '操作',
        tableItem: {
            width: 90,
            fixed: 'right',
            render: (text, record) => (
                <DataTable.Oper>
                    <Button tooltip="修改" onClick={e => self.onUpdate(record)}>
                        <Icon type="edit" />
                    </Button>
                    <Button tooltip="删除" onClick={e => self.onDelete(record)}>
                        <Icon type="trash" />
                    </Button>
                </DataTable.Oper>
            )
        }
    }
];
